

        <g:set var="entityName" value="${message(code: 'advice.label', default: 'Advice')}" />
            <div class="list">
                <table>
                    <thead>
                        <tr>
                        
                            <th>发布人</th>
                        
                            <th>内容</th>

                            <th></th>
                        
                        </tr>
                    </thead>
                    <tbody>
                    <g:each in="${adviceInstanceList}" status="i" var="adviceInstance">
                        <tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
                        
                            <td>${fieldValue(bean: adviceInstance, field: "user.realname")}</td>
                        
                            <td>${fieldValue(bean: adviceInstance, field: "content")}</td>

                            <td>
                                <g:ifAnyGranted role="ROLE_ADMIN">
                                    <g:link action="delete" id="${adviceInstance.id}" onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');">删除</g:link>
                                 </g:ifAnyGranted>
                                 <g:if test="${adviceInstance.user.id.toString() == loggedInUserInfo(field:'id').toString()}">
                                    <g:link action="delete" id="${adviceInstance.id}" onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');">删除</g:link>
                                 </g:if>
                            </td>
                        
                        </tr>
                    </g:each>
                    </tbody>
                </table>
            </div>
            <div class="paginateButtons">
                <x:paginate total="${adviceInstanceTotal}" />
            </div>

            <g:isLoggedIn>
            <g:form action="save" method="post" name="createAdvice">
                <div class="dialog">
                    <table>
                        <tbody>
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="content"><g:message code="advice.content.label" default="Content" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: adviceInstance, field: 'content', 'errors')}">
                                    <g:textArea name="content" cols="40" rows="5" value="${adviceInstance?.content}" />
                                </td>
                            </tr>
                        
                        </tbody>
                    </table>
                </div>
                <div class="buttons">
                    <span class="button"><g:submitButton name="create" class="save" value="${message(code: 'default.button.create.label', default: 'Create')}" /></span>
                </div>
            </g:form>
            </g:isLoggedIn>
            
             <g:isNotLoggedIn>
                请<g:link controller="login" >登录</g:link>后留言
             </g:isNotLoggedIn>
